﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class DungeonController : MonoBehaviour
{

    public static DungeonController instance;

    public List<GameObject> dungeonLevel;

    private void Awake()
    {
        instance = this;
    }

    private void OnDestroy()
    {
        instance = null;
    }
    private void Start()
    {
        for (int i = 0; i < dungeonLevel.Count; i++)
        {
            dungeonLevel[i].SetActive(false);   
        }
        IntoDungeon();
    }
    public void IntoDungeon()
    {
        int level = GameData.GetDungeonProgress();
        if (level < dungeonLevel.Count)
        {
            dungeonLevel[level].gameObject.SetActive(true); 
        }
      
    }
  
    private void Update()
    {
        if (GameData.isDungeonChange)
        {
            IntoDungeon();
            GameData.isDungeonChange = false;
        }
    }


}
